﻿#ifndef OPENGLWIDGET_H
#define OPENGLWIDGET_H

#include <QOpenGLWidget>
#include <QOpenGLFunctions>
#include <QOpenGLBuffer>
#include <QMatrix4x4>

class QOpenGLShaderProgram;

class OpenGLWidget : public QOpenGLWidget, protected QOpenGLFunctions
{
public:
    explicit OpenGLWidget(QWidget *parent = 0);

protected:
    void initializeGL();
    void paintGL();
    void resizeGL(int w, int h);

    void initVbo();
private:
    QOpenGLShaderProgram *program;
    GLuint programId;
    GLint matrixLocation;
    GLint vertexLocation;
    GLint clorLocation;

    GLuint vVerticesLen;
    GLuint triIndexLen;
    GLuint colorsLen;

    GLuint verVbo;
    GLuint indexVbo;
    GLuint colorVbo;

    QMatrix4x4 projection;

};

#endif // OPENGLWIDGET_H
